package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.UndoLogEntity;
import com.bush.mall.product.service.UndoLogService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("undolog")
@Api(tags = "管理" )
public class UndoLogController {

    @Resource(name= UndoLogService.BEAN_ID)
    private UndoLogService undoLogService;

    /**
     * 分页查询列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return undoLogService.queryForPage(current,size);
    }

    /**
     * 保存表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存表单")
    @PostMapping("saveUndoLog")
    public Result saveUndoLog(@RequestBody UndoLogEntity undoLog){
        return undoLogService.saveUndoLog(undoLog);
    }

    /**
     * 修改表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改表单")
    @PutMapping("updateUndoLog")
    public Result updateUndoLog(@RequestBody UndoLogEntity undoLog){
        return undoLogService.updateUndoLog(undoLog);
    }

    /**
     * 通过指定id删除
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除")
    @DeleteMapping("deleteUndoLog")
    public Result deleteUndoLog(Long id){
        return undoLogService.deleteUndoLog(id);
    }

}
